# 作者: 薛文寅仟
# 2024年12月27日09时45分36秒
# 5443912@qq.com
def tuple_error():
    a = [1]
    print(type(a))
    b = (1,)
    for i in b:
        print(i)
    print(type(b))


def tuple_base():
    info_tuple = ("zhangsan", 18, 1.75)
    print("%s,年龄%d岁，身高%.2f" % info_tuple)
    tuple_str = "%s,年龄%d岁，身高%.2f" % info_tuple
    print(tuple_str)
    print("*" * 50)
    # 1. 取值和取索引
    print(info_tuple[0])
    # 已经知道数据的内容，希望知道该数据在元组中的索引
    print(info_tuple.index("zhangsan"))
    # 2. 统计计数
    print(info_tuple.count("zhangsan"))
    # 统计元组中包含元素的个数
    print(len(info_tuple))
    print("*" * 50)


info = ("zhangsan", 18)
print(list(info))
print(tuple(list(info)))

# if __name__ == '__main__':
#     tuple_error()
#     tuple_base()
